<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="../../../../lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.useso.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="../../../../lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="../../../../css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="../../../../images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="../../../../images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="../../../../images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="../../../../images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="k8s集群搭建,">










<meta name="description" content="什么？资源不够用了？ 怼服务器配置啊(向上扩展)，怼机器啊(横向扩展)！   (注: 该节点添加是基于之前k8s集群搭建的环境进行)￼ 1.系统初始化:a. 主机名配置 node4: echo &amp;quot;linux-node4.example.com&amp;quot; &amp;gt; /etc/hostname b. 设置/etc/hosts保证主机名能够解析 node4: echo &amp;quot;192.1">
<meta name="keywords" content="k8s集群搭建">
<meta property="og:type" content="article">
<meta property="og:title" content="10-K8s集群搭建---新增Node节点">
<meta property="og:url" content="http://demo_demo.gitee.io/2018/06/29/10k8s-ji-qun-da-jianxin-zengnode-jie-dian/index.html">
<meta property="og:site_name" content="运维人">
<meta property="og:description" content="什么？资源不够用了？ 怼服务器配置啊(向上扩展)，怼机器啊(横向扩展)！   (注: 该节点添加是基于之前k8s集群搭建的环境进行)￼ 1.系统初始化:a. 主机名配置 node4: echo &amp;quot;linux-node4.example.com&amp;quot; &amp;gt; /etc/hostname b. 设置/etc/hosts保证主机名能够解析 node4: echo &amp;quot;192.1">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304316863865.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304308410933.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304310244907.jpg">
<meta property="og:updated_time" content="2018-12-10T10:28:44.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="10-K8s集群搭建---新增Node节点">
<meta name="twitter:description" content="什么？资源不够用了？ 怼服务器配置啊(向上扩展)，怼机器啊(横向扩展)！   (注: 该节点添加是基于之前k8s集群搭建的环境进行)￼ 1.系统初始化:a. 主机名配置 node4: echo &amp;quot;linux-node4.example.com&amp;quot; &amp;gt; /etc/hostname b. 设置/etc/hosts保证主机名能够解析 node4: echo &amp;quot;192.1">
<meta name="twitter:image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304316863865.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://demo_demo.gitee.io/2018/06/29/10k8s-ji-qun-da-jianxin-zengnode-jie-dian/">





  <title>10-K8s集群搭建---新增Node节点 | 运维人</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
<a href="https://github.com/guomaoqiu" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#FD6C6C; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">运维人</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">生命在于折腾</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://demo_demo.gitee.io">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="OutMan">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="运维人">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">10-K8s集群搭建---新增Node节点</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-06-29T15:29:10+08:00">
                2018-06-29
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Docker/" itemprop="url" rel="index">
                    <span itemprop="name">Docker</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Docker/虚拟化-amp-云计算-amp-大数据/" itemprop="url" rel="index">
                    <span itemprop="name">虚拟化&amp;云计算&amp;大数据</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>什么？资源不够用了？ 怼服务器配置啊(向上扩展)，怼机器啊(横向扩展)！  </p>
<p>(注: 该节点添加是基于之前k8s集群搭建的环境进行)<br><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304316863865.jpg" alt="">￼</p>
<h2 id="1-系统初始化"><a href="#1-系统初始化" class="headerlink" title="1.系统初始化:"></a>1.系统初始化:</h2><p>a. 主机名配置</p>
<pre><code>node4:
echo &quot;linux-node4.example.com&quot; &gt; /etc/hostname
</code></pre><p>b. 设置/etc/hosts保证主机名能够解析</p>
<pre><code>node4:
echo &quot;192.168.56.14 linux-node4 linux-node4.example.com&quot; &gt;&gt; /etc/hosts
</code></pre><p>c. 关闭SELinux及防火墙</p>
<pre><code>node4:
systemctl disable firewalld; systemctl stop firewalld 
sed -i &apos;s/SELINUX=enforcing/SELINUX=disabled/g&apos; /etc/selinux/config
</code></pre><p>d. 环境变量配置(后续k8s相关命令都会放到/opt/kubernetes/bin目录下)</p>
<pre><code>echo &quot;PATH=$PATH:$HOME/bin:/opt/kubernetes/bin&quot; &gt;&gt;  ~/.bash_profile
source ~/.bash_profile
</code></pre><h2 id="4-安装Docker"><a href="#4-安装Docker" class="headerlink" title="4.安装Docker"></a>4.安装Docker</h2><p>a：使用国内Docker源</p>
<pre><code>[root@linux-node4 ~]# cd /etc/yum.repos.d/
[root@linux-node4 yum.repos.d]# wget \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
</code></pre><p>b：Docker安装：</p>
<pre><code>[root@linux-node4 ~]# yum install -y docker-ce
</code></pre><p>c：启动后台进程：</p>
<pre><code>[root@linux-node4 ~]# systemctl enable docker
[root@linux-node4 ~]# systemctl start docker
</code></pre><h2 id="5-准备部署目录"><a href="#5-准备部署目录" class="headerlink" title="5.准备部署目录"></a>5.准备部署目录</h2><pre><code>[root@linux-node4 ~]#  mkdir -p /opt/kubernetes/{cfg,bin,ssl,log}
# 目录结构, 所有文件均存放在/opt/kubernetes目录下：
[root@linux-node4 ~]# tree -L 1 /opt/kubernetes/
/opt/kubernetes/
├── bin   #二进制文件
├── cfg   #配置文件
├── log   #日志文件
└── ssl   #证书文件
</code></pre><h2 id="6-做好master节点跟其他node节点的ssh互信-便于搭建"><a href="#6-做好master节点跟其他node节点的ssh互信-便于搭建" class="headerlink" title="6.做好master节点跟其他node节点的ssh互信,便于搭建"></a>6.做好master节点跟其他node节点的ssh互信,便于搭建</h2><pre><code>[root@linux-node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.56.14
</code></pre><h2 id="7-拷贝配置-from-master"><a href="#7-拷贝配置-from-master" class="headerlink" title="7.拷贝配置(from master)"></a>7.拷贝配置(from master)</h2><h3 id="1-拷贝CFSSL"><a href="#1-拷贝CFSSL" class="headerlink" title="1.拷贝CFSSL"></a>1.拷贝CFSSL</h3><pre><code>[root@linux-node1 ~]# scp /opt/kubernetes/bin/cfssl* 192.168.56.14:/opt/kubernetes/bin
</code></pre><h3 id="2-分发证书"><a href="#2-分发证书" class="headerlink" title="2.分发证书"></a>2.分发证书</h3><pre><code>[root@linux-node1 ssl]# scp ca.csr ca.pem ca-key.pem ca-config.json 192.168.56.14:/opt/kubernetes/ssl
</code></pre><h3 id="3-拷贝kubernetes-证书和私钥"><a href="#3-拷贝kubernetes-证书和私钥" class="headerlink" title="3.拷贝kubernetes 证书和私钥"></a>3.拷贝kubernetes 证书和私钥</h3><pre><code>[root@linux-node1 ssl]# scp /opt/kubernetes/ssl/kubernetes*.pem 192.168.56.14:/opt/kubernetes/ssl/
</code></pre><h3 id="4-拷贝kubelet，kube-proxy软件包"><a href="#4-拷贝kubelet，kube-proxy软件包" class="headerlink" title="4.拷贝kubelet，kube-proxy软件包"></a>4.拷贝kubelet，kube-proxy软件包</h3><pre><code>[root@linux-node1 ~]# cd /usr/local/src/kubernetes/server/bin/
[root@linux-node1 bin]# scp kubelet kube-proxy 192.168.56.14:/opt/kubernetes/bin/
</code></pre><h3 id="5-拷贝角色绑定文件"><a href="#5-拷贝角色绑定文件" class="headerlink" title="5.拷贝角色绑定文件"></a>5.拷贝角色绑定文件</h3><pre><code>[root@linux-node1 ~]# scp /opt/kubernetes/cfg/bootstrap.kubeconfig 192.168.56.14:/opt/kubernetes/cfg
</code></pre><h3 id="6-拷贝CNI支持配置"><a href="#6-拷贝CNI支持配置" class="headerlink" title="6.拷贝CNI支持配置"></a>6.拷贝CNI支持配置</h3><pre><code>[root@linux-node1 ~]# ssh linux-node4 &quot;mkdir /etc/cni/net.d -p&quot;
[root@linux-node1 ~]# scp /etc/cni/net.d/10-default.conf linux-node4:/etc/cni/net.d/
</code></pre><h3 id="7-创建kubelet所需目录"><a href="#7-创建kubelet所需目录" class="headerlink" title="7.创建kubelet所需目录"></a>7.创建kubelet所需目录</h3><pre><code>[root@linux-node1 ~]# ssh linux-node4 &quot;mkdir /var/lib/kubelet&quot;
</code></pre><h3 id="8-拷贝Flannel网络证书"><a href="#8-拷贝Flannel网络证书" class="headerlink" title="8.拷贝Flannel网络证书"></a>8.拷贝Flannel网络证书</h3><pre><code>[root@linux-node1 ~]# scp  /opt/kubernetes/ssl/flanneld*.pem 192.168.56.14:/opt/kubernetes/ssl/
</code></pre><h3 id="9-复制flanner相关软件包"><a href="#9-复制flanner相关软件包" class="headerlink" title="9.复制flanner相关软件包"></a>9.复制flanner相关软件包</h3><pre><code>[root@linux-node1 ~]# ssh linux-node4 &quot;mkdir /opt/kubernetes/bin/cni&quot;
[root@linux-node1 ~]# scp /opt/kubernetes/bin/cni/* 192.168.56.14:/opt/kubernetes/bin/cni/
[root@linux-node1 ~]# scp /usr/lib/systemd/system/flannel.service 192.168.56.14:/usr/lib/systemd/system/
[root@linux-node1 ~]# scp /opt/kubernetes/cfg/flannel 192.168.56.14:/opt/kubernetes/cfg/
[root@linux-node1 ~]# cd /usr/local/src
[root@linux-node1 src]# scp flanneld mk-docker-opts.sh 192.168.56.14:/opt/kubernetes/bin/
[root@linux-node1 src]# cd /usr/local/src/kubernetes/cluster/centos/node/bin/
[root@linux-node1 bin]# scp remove-docker0.sh 192.168.56.14:/opt/kubernetes/bin/

# docker 服务脚本
[root@linux-node1 bin]# scp /usr/lib/systemd/system/docker.service 192.168.56.14:/usr/lib/systemd/system/
</code></pre><h3 id="10-拷贝kubelet系统服务配置"><a href="#10-拷贝kubelet系统服务配置" class="headerlink" title="10.拷贝kubelet系统服务配置"></a>10.拷贝kubelet系统服务配置</h3><pre><code>[root@linux-node1 ~]# scp /usr/lib/systemd/system/kubelet.service 192.168.56.14:/usr/lib/systemd/system/
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl daemon-reload&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl enable kubelet&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl start kubelet&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl status kubelet&quot;
# 然后在node1节点查看TLS证书请求，通过以下就行了，如果结果为空，就需要查看kubelet的日志啦，反正我在这里就跳进了一回自己挖的坑o(╥﹏╥)o

[root@linux-node1 ~]# kubectl get csr
[root@linux-node1 ~]# kubectl get csr|grep &apos;Pending&apos; | awk &apos;NR&gt;0{print $1}&apos;| xargs kubectl certificate
[root@linux-node1 ~]# kubectl get nodes
NAME            STATUS    ROLES     AGE       VERSION
192.168.56.11   Ready     master    1d        v1.10.1
192.168.56.12   Ready     node      31d       v1.10.1
192.168.56.13   Ready     node      31d       v1.10.1
192.168.56.14   Ready     node      1d        v1.10.1

# 以上，新的计算节点192.168.56.14已经成功添加
</code></pre><h3 id="11-配置kube-proxy使用LVS"><a href="#11-配置kube-proxy使用LVS" class="headerlink" title="11.配置kube-proxy使用LVS"></a>11.配置kube-proxy使用LVS</h3><pre><code>[root@linux-node4 ~]# yum install -y ipvsadm ipset conntrack
</code></pre><h3 id="12-分发kube-proxy证书"><a href="#12-分发kube-proxy证书" class="headerlink" title="12.分发kube-proxy证书"></a>12.分发kube-proxy证书</h3><pre><code>[root@linux-node1 ssl]# scp kube-proxy*.pem 192.168.56.14:/opt/kubernetes/ssl/
</code></pre><h3 id="13-分发kubeconfig配置文件"><a href="#13-分发kubeconfig配置文件" class="headerlink" title="13.分发kubeconfig配置文件"></a>13.分发kubeconfig配置文件</h3><pre><code>[root@linux-node1 ssl]# scp ../cfg/kube-proxy.kubeconfig 192.168.56.14:/opt/kubernetes/cfg/
</code></pre><h3 id="14-安装nfs-因为node节点作为客户端也需要安装nfs客户端工具"><a href="#14-安装nfs-因为node节点作为客户端也需要安装nfs客户端工具" class="headerlink" title="14.安装nfs(因为node节点作为客户端也需要安装nfs客户端工具)"></a>14.安装nfs(因为node节点作为客户端也需要安装nfs客户端工具)</h3><pre><code>[root@linux-node1 ssl]# ssh linux-node4 &quot;yum -y install nfs-utils rpcbind&quot;
</code></pre><h3 id="15-创建工作目录"><a href="#15-创建工作目录" class="headerlink" title="15.创建工作目录"></a>15.创建工作目录</h3><pre><code>[root@linux-node1 ~]# ssh linux-node4 &quot;mkdir /var/lib/kube-proxy&quot;
</code></pre><h3 id="16-拷贝服务配置文件"><a href="#16-拷贝服务配置文件" class="headerlink" title="16.拷贝服务配置文件"></a>16.拷贝服务配置文件</h3><pre><code>[root@linux-node1 ~]# cp /usr/lib/systemd/system/kube-proxy.service 192.168.56.14:/usr/lib/systemd/system/kube-proxy.service

# 注意需要修改配置文件的IP
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl daemon-reload&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl enable kube-proxy&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl start kube-proxy&quot;
[root@linux-node1 ~]# ssh linux-node4 &quot;systemctl status kube-proxy&quot;
</code></pre><h2 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h2><p>我们先来Scaling flask-app pod到20个, 然后看Kubenertes Scheduler是否能把请求调度到新的节点上面</p>
<pre><code>[root@linux-node1 ~]# kubectl scale --replicas=20 deployment.extensions/flask-app -n flask-app-extions-stage
deployment.extensions &quot;flask-app&quot; scaled
</code></pre><p><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304308410933.jpg" alt="">￼<br>上图可以看到 Scaling的pod已经由Kubenertes Scheduler调度到各个node运行，并且状态已经是Running</p>
<p><img src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/2018/07/15304310244907.jpg" alt="">￼</p>
<p>以上，可以看到我新添加的节点已经成功加到了集群当中，而且运行结果也是我预期的；唯一不足的地方是这个步骤如果后期在工作中用到的话是不太方便维护的,但是手动这样会知道一个节点需要用到哪些东西，需要怎么配置，也算是对k8s的运行机制有更深点的认知。<br>后续有时间还是搞一下用SaltStack来部署吧~🍺🍺🍺</p>

      
    </div>
    
    
    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>


  
</div>
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="../../../../tags/k8s集群搭建/" rel="tag"># k8s集群搭建</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="../../27/flask-app-for-kubernetes/" rel="next" title="Flask App for Kubernetes">
                <i class="fa fa-chevron-left"></i> Flask App for Kubernetes
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="../../../07/02/e5-8a-9d-e5-90-9b-e8-8e-ab-e6-83-9c-e9-87-91-e7-bc-95-e8-a1-a3-ef-bc-8c-e5-8a-9d-e5-90-9b-e6-83-9c-e5-8f-96-e5-b0-91-e5-b9-b4-e6-97-b6-e3-80-82-trashed/" rel="prev" title="劝君莫惜金缕衣，劝君惜取少年时。">
                劝君莫惜金缕衣，劝君惜取少年时。 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png" alt="OutMan">
            
              <p class="site-author-name" itemprop="name">OutMan</p>
              <p class="site-description motion-element" itemprop="description">😊</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="../../../../archives/">
              
                  <span class="site-state-item-count">79</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="../../../../categories/index.html">
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="../../../../tags/index.html">
                  <span class="site-state-item-count">46</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/guomaoqiu" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:guomaoqiu@google.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-系统初始化"><span class="nav-number">1.</span> <span class="nav-text">1.系统初始化:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-安装Docker"><span class="nav-number">2.</span> <span class="nav-text">4.安装Docker</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-准备部署目录"><span class="nav-number">3.</span> <span class="nav-text">5.准备部署目录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-做好master节点跟其他node节点的ssh互信-便于搭建"><span class="nav-number">4.</span> <span class="nav-text">6.做好master节点跟其他node节点的ssh互信,便于搭建</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-拷贝配置-from-master"><span class="nav-number">5.</span> <span class="nav-text">7.拷贝配置(from master)</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-拷贝CFSSL"><span class="nav-number">5.1.</span> <span class="nav-text">1.拷贝CFSSL</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-分发证书"><span class="nav-number">5.2.</span> <span class="nav-text">2.分发证书</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-拷贝kubernetes-证书和私钥"><span class="nav-number">5.3.</span> <span class="nav-text">3.拷贝kubernetes 证书和私钥</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-拷贝kubelet，kube-proxy软件包"><span class="nav-number">5.4.</span> <span class="nav-text">4.拷贝kubelet，kube-proxy软件包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-拷贝角色绑定文件"><span class="nav-number">5.5.</span> <span class="nav-text">5.拷贝角色绑定文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-拷贝CNI支持配置"><span class="nav-number">5.6.</span> <span class="nav-text">6.拷贝CNI支持配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-创建kubelet所需目录"><span class="nav-number">5.7.</span> <span class="nav-text">7.创建kubelet所需目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-拷贝Flannel网络证书"><span class="nav-number">5.8.</span> <span class="nav-text">8.拷贝Flannel网络证书</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#9-复制flanner相关软件包"><span class="nav-number">5.9.</span> <span class="nav-text">9.复制flanner相关软件包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#10-拷贝kubelet系统服务配置"><span class="nav-number">5.10.</span> <span class="nav-text">10.拷贝kubelet系统服务配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#11-配置kube-proxy使用LVS"><span class="nav-number">5.11.</span> <span class="nav-text">11.配置kube-proxy使用LVS</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#12-分发kube-proxy证书"><span class="nav-number">5.12.</span> <span class="nav-text">12.分发kube-proxy证书</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#13-分发kubeconfig配置文件"><span class="nav-number">5.13.</span> <span class="nav-text">13.分发kubeconfig配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#14-安装nfs-因为node节点作为客户端也需要安装nfs客户端工具"><span class="nav-number">5.14.</span> <span class="nav-text">14.安装nfs(因为node节点作为客户端也需要安装nfs客户端工具)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#15-创建工作目录"><span class="nav-number">5.15.</span> <span class="nav-text">15.创建工作目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#16-拷贝服务配置文件"><span class="nav-number">5.16.</span> <span class="nav-text">16.拷贝服务配置文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#验证"><span class="nav-number">6.</span> <span class="nav-text">验证</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">OutMan</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="../../../../lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="../../../../js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="../../../../js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="../../../../js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="../../../../js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="../../../../js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
